package com.lkbaby.iterator;

import java.util.Arrays;

public class NameContiner implements Continer {

	String[] array;

	public NameContiner(String[] array) {
		this.array = Arrays.copyOfRange(array, 0, array.length);
	}

	@Override
	public Iterator getIterator() {
		return new NameIterator();
	}

	private class NameIterator implements Iterator {
		// 索引
		int index;

		@Override
		public boolean hasNext() {
			return index < array.length;
		}

		@Override
		public Object next() {
			return array[index++];
		}
	}
}
